<template>
  <div>
    <div class="box">
      <FormPanel ref="feesSettlementPanel" :list="topList" :cols="4" :labelWidth="90" :isSubmitBtn="false" />
    </div>
    <FilterTable
      ref="payObjTable"
      selectionType="single"
      :columns="columns"
      :datakey="'rows'"
      height="auto"
      :onColumnsChange="columns => (this.columns = columns)"
      :onRowSelectChange="columns => (this.partChangeColumns = columns)"
    ></FilterTable>
  </div>
</template>

<script>
import { dictionary } from '@/utils/dictMixin';
export default {
  name: 'Feessettlement',
  mixins: [dictionary],
  data() {
    this.config = {
      defaultType: 'default'
    };
    this.BaseTable = null;
    return {
      topList: this.createTopList(),
      columns: this.createColumns()
    };
  },
  mounted() {
    this.BaseTable = this.$refs.payObjTable.$refs.pageTable;
  },
  methods: {
    createTopList() {
      return [
        {
          type: 'INPUT',
          label: '应收总金额',
          fieldName: 'labourAmount',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '实收总金额',
          fieldName: 'calcRealReceiveAmount',
          disabled: true
        }
      ];
    },
    createColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 70,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '收费对象代码',
          dataIndex: 'PAYMENT_OBJECT_CODE',
          width: 150,
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '收费对象名称',
          dataIndex: 'PAYMENT_OBJECT_NAME',
          width: 150,
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '应收金额',
          dataIndex: 'RECEIVEABLE_AMOUNT',
          width: 150,
          sorter: true,
          filter: true,
          filterType: 'input',
          precision: 2
        },
        {
          title: '折扣率',
          dataIndex: 'DISCOUNT',
          width: 150,
          sorter: true,
          filter: true,
          filterType: 'input',
          precision: 2
        },
        {
          title: '折让金额',
          dataIndex: 'DISCOUNT_AMOUNT',
          width: 150,
          sorter: true,
          filter: true,
          filterType: 'input',
          precision: 2
        },
        {
          title: '实收金额',
          dataIndex: 'REAL_RECEIVE_AMOUNT',
          width: 150,
          sorter: true,
          filter: true,
          filterType: 'input',
          precision: 2
        }
      ];
    },
    openModel(item, row) {
      console.log(row, '888888888*****');
      this.topList[0].initialValue = item.receivableAmount;
      this.topList[1].initialValue = item.realReceiveAmount;
      this.BaseTable.EXECUTE_INSERT(row);
    },
    closeDialog() {
      this.$emit('close', false);
    }
  }
};
</script>

<style scoped></style>
